//
//  MBOrderSectionHeaderView.m
//  MemberBusiness-ios
//
//  Created by cherry pu on 2018/4/24.
//  Copyright © 2018年 zhangXin. All rights reserved.
//

#import "MBOrderSectionHeaderView.h"

@interface MBOrderSectionHeaderView ()
@property (nonatomic,weak)UILabel* orderNumLabel;
@property (nonatomic,weak)UILabel* moneyLabel;

@end

@implementation MBOrderSectionHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        UIView* line = [[UIView alloc]init];
        line.backgroundColor = COLOR_BG;
        [self addSubview:line];
        
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, [UIView lf_sizeFromIphone6:10]));
        }];
        
        self.backgroundColor = [UIColor whiteColor];
        UILabel* orderNumLabel = [[UILabel alloc]init];
        self.orderNumLabel = orderNumLabel;
        orderNumLabel.text = @"订单号：12256325622358855";
        orderNumLabel.font = [UIFont lf_systemFontOfSize:12];
        orderNumLabel.textColor = [UIColor colorWithR:24 G:24 B:24];
        [self addSubview:orderNumLabel];
        
        [orderNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(line.mas_bottom).offset([UIView lf_sizeFromIphone6:15]);
            make.left.equalTo(self).offset([UIView lf_sizeFromIphone6:12]);
        }];

        UILabel* moneyLabel = [[UILabel alloc]init];
        self.moneyLabel = moneyLabel;
        moneyLabel.text = @"￥1250.01";
        moneyLabel.font = [UIFont lf_systemFontOfSize:14];
        moneyLabel.textColor = [UIColor colorWithR:255 G:0 B:7];
        [self addSubview:moneyLabel];
        
        [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(orderNumLabel);
            make.right.equalTo(self).offset([UIView lf_sizeFromIphone6:-13]);
        }];

    }
    return self;
}

-(void)setViewModel:(MBOrderTableCellViewModel *)viewModel
{
    _viewModel = viewModel;
    
    self.orderNumLabel.text = [NSString stringWithFormat:@"订单号：%@",viewModel.dataModel.order_sn];
    self.moneyLabel.text = [NSString stringWithFormat:@"￥%@",viewModel.dataModel.order_amount];
}

@end
